home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 16
/
Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso
/
Aminet
/
util
/
rexx
/
addressee.lha
/
addressee.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-10-21
|
9KB
|
280 lines
/* Final Writer Addressing Script. */
/**************************************************
* *
* History: *
* Written 18 October by Andrew Bruno (c) *
* *
* Purpose: *
* To add the addressee's name and address *
* to the top of the letter and to print out *
* and envelope if you want. *
* *
* *
* Notes: *
* It is written for a "simple address", *
* who's structure is shown below. *
* Oh, and is ready to use for most Australian *
* addresses. *
* *
* Structure of files: *
* (example) *
* *
* Andrew Bruno *
* 17/73-77 Frederick St. *
* Ashfield NSW *
* 2131 ( <----- equ ZIP code) *
* *
* This is because the postcode is put on *
* the bottom right corner in Australia, *
* and so must be seperate from the other *
* data so FW (and AREXX) can put it where *
* it should be *
* *
* *
* Disclaimer: *
* This is written as is. *
* If you like it, please tell me. *
* *
* Thanks: *
* To all the people who helped me at the *
* start when learning about reqtools and *
* AREXX, etc. *
* *
**************************************************/
/**************************************************
* *
* These are the sizes of the envelopes *
* that should be entered in the variables *
* used by the script. *
* *
* *
*************************************************** *
* *
* Envelope sizes: *
* small- 14.5 x 9 *
* medium - 16 x 11.5 *
* big (wide) - 22 x 11 *
* (add to this if you want) *
* *
* *
**************************************************/
/* load the required library */
if ~show('L',"rexxreqtools.library") then do
if ~addlib('rexxreqtools.library',0,-30,0) then do
say 'reqtools library not available'
exit 10
end
end
fonttag = ""
NL = '0a'x
/* local variables for use for envelope size: */
lc = 0 /* a counter */
telc = 0 /* another counter */
normalfont = softsans
normalsize = 12
envprt = 0 /* I do NOT want envelopes printed */
/*
Start deletion block
please delete this little block, as I guess it will become
a little annoying after a while anyway. :-)
*/
call rtezrequest( "This script will NOT print the" || NL ||,
"envelope for you, it will" || NL ||,
"ONLY prepare the page to print" || NL ||,
"it. Incase the printer is off", "Thanks")
/* end deletion block */
/* script lables */
pubscrname ="FinalWriterPubScreen" /* public screen name */
startdir = "dh4:languages/arexx/fw/names" /* start dir */
startfile = "" /* suggested filename */
scrtag ="rt_pubscrname="||pubscrname
pathtag = "rtfi_initialpath="||startdir
postag = "rt_reqpos=reqpos_pointer" /* requester appears under pointer */
hgttag = "rtfi_height="||200 /* height of requester */
matchtag = "rtfi_matchpat=~(#?.info)" /* show only files that end in .txt, can also use '*'something */
flagtag = "rtfi_flags=freqf_patgad" /* show the matchtag in the requester */
bufftag = "rtfi_buffer=true"
tags = scrtag pathtag postag hgttag matchtag flagtag bufftag
/* show the requester */
filename = rtfilerequest( , startfile,"Select a file","OK" ,tags)
/* check if user selected a file or cancelled */
if rtresult == 0 then /* user cancelled requester */
call cancelled
else /* user selected a file */
call selected
skip:
/*-------------------- exit point ------------------*/
exit
/*-------------------- exit point ------------------*/
cancelled:
/* do here what you want if the requester is cancelled */
call rtezrequest("You didn't pick a file.", "No", , )
return
selected:
/* so here it all starts. */
call rtezrequest( "Do you want to" || NL ||,
"print an envelope" || NL ||,
"for this person?",,
"_Yes|_No", , fonttag) /* 1 = Yes, 0 = No */
if result == 0 then envprt = 0
else
envprt = 1 /* sorry for the slack bit of coding here. */
/* set up FW for default printing font / size */
address 'FINALW.1'
Font normalfont
FontSize normalsize
call open('blah',filename,'R')
do until EOF('blah')
n1 = readln('blah')
address 'FINALW.1'
type n1
newparagraph
end
call close('blah')
if envprt == 0 then
signal skip
else
/* Set up for printing the envelope. */
/****************************************************
Ask for the size of the envelope
the person want to print on.
The resopnce is 1, 2 or 3 and stored in result.
****************************************************/
call rtezrequest( "Please select the envelope size" || NL ||,
"you wish to use:" || NL ||,
""||NL||,
"dimesnsions are shown as " || NL ||,
"<--> / top to bottom" || NL ||,
"1 - 14.5 x 9" || NL ||,
"2 - 16 x 11.5" || NL ||,
"3 - 22 x 11",,
"_1|_2|_3", , fonttag)
if result = 1 then
call small
else
if result = 2 then
call medium
else
call big
address 'FINALW.1'
new
wait 10 /* this is needed for FW to keep up with itself */
/****************************
Set up FW for the "new"
document with paper sizes etc.
****************************/
address 'FINALW.2'
PageSetup PAGETYPE Custom Width ewidth Height eheight ORIENT Tall PAGES LeftRight PRINTERTYPE Sheetfed TOP 0.635 BOTTOM 0.635
SectionSetup Top tm Bottom 1
DisplayPrefs GUIDES pe RULERS All MEASURE Metric BUTTSTRIP 1 BUTTPOS Left INFOSTRIP On
Setmeasure ruler
Indent eindent
Font envfont
FontSize envfontsize
FontColor Black
/* View 130 */
type " "
do until telc = teln
address 'FINALW.2'
newparagraph
telc = telc + 1
end
call open('blah',filename,'R')
do until lc = 3 /* 3 lines to be read in as normal! */
n1 = readln('blah')
address 'FINALW.2'
type n1
newparagraph
lc = lc + 1
end /* Now put in the post code in the bottom right corner */
n1 = readln('blah')
address 'FINALW.2'
newparagraph
newparagraph
Indent pcindent
type n1
call close('blah')
return
/* the end of the script. Tables follow. */
small:
envfont = Bandit_BoldItalic
ewidth = 14.5 /* width of the envelope */
eheight = 9 /* height of the envelope */
eindent = 0 /* indent from left margin */
pcindent = 6 /* indent for the postcode */
envfontsize = 18 /* font size */
teln = 1 /* blank line count at top */
tm = 1 /* top margin of text */
return
medium:
envfont = Bandit_BoldItalic
ewidth = 16 /* width of the envelope */
eheight = 11.5 /* height of the envelope */
eindent = 0 /* indent from left margin */
pcindent = 8 /* indent for the postcode */
envfontsize = 20 /* font size */
teln = 2 /* blank line count at top */
tm = 2 /* top margin of text */
return
big:
envfont = Bandit_BoldItalic
ewidth = 22 /* width of the envelope */
eheight = 11 /* height of the envelope */
eindent = 2.5 /* indent from left margin */
pcindent = 14 /* indent for the postcode */
envfontsize = 20 /* font size */
teln = 2 /* blank line count at top */
tm = 1 /* top margin of text */
return
/* end*/